package cn.com.zpark.cookie;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.cookie
 * @ClassName: CookieDemo01
 * @Description:
 * @author: RZS
 * @date: 2021/11/15  14:46
 */
@WebServlet("/cd1.do")
public class CookieDemo01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 创建cookie
        Cookie cookie = new Cookie("dc", "dachui");



        // 将Cookie添加到浏览器
        response.addCookie(cookie);
    }
}
